package org.groupg.project;

import groovy.lang.GroovyShell;
import groovy.lang.Binding;
import groovy.lang.Script;

public class GroovyExample {
    public static void main(String[] args) {
        // 创建Binding对象，用于传递变量
        Binding binding = new Binding();
        binding.setVariable("name", "World");

        // 创建GroovyShell对象
        GroovyShell shell = new GroovyShell(binding);

        // 执行Groovy脚本
//        Object result = shell.evaluate("println 'Hello, ' + name; return 'Groovy is fun!'");

        // 输出结果
//        System.out.println(result);
        Script script = shell.parse("anumber>4");
        System.out.println(script.run());
    }
}